<template>
<!--index.wxml-->

  <view class="container">
    
    <i-cell-group style="width:100%;" v-if="list.length > 0">
        <i-cell v-for="(item, index) in list" :key="index" :title="item.address" :label="item.date" :value="item.total_price + '元'"></i-cell>
       
    </i-cell-group>
	<view class="" v-else style="width: 150rpx;height: 100vh;display: flex;flex-direction: column;align-items: center;justify-content: center;">
		<image src="../../static/images/no-data.png" style="width: 80rpx;height: 80rpx;"></image>
		<view class="" style="margin-top: 20rpx;">暂无数据</view>
	</view>
  </view>
</template>

<script>
//index.js
const app = getApp().globalData;
import iCellGroup from "../../dist/cell-group/index";
import iCell from "../../dist/cell/index";
import { selectOrder } from '@/api/setting.js'

export default {
  data() {
    return {
      background: ["/static/images/agent_img01599810087.jpeg", "/static/images/idimg01599807828.jpeg", "/static/images/idimg11599810002.jpeg"],
      indicatorDots: true,
      vertical: false,
      autoplay: false,
      interval: 2000,
      duration: 500,
	  list:[]
    };
  },

  components: {
    iCellGroup,
    iCell
  },
  props: {},
  onLoad: function () {
	  this.getorder()
  },
  methods: {
	  getorder: function () {
	    var _this = this;
	    let user_id = uni.getStorageSync('userInfo') ?uni.getStorageSync('userInfo').user_id : ''
		selectOrder({
			user_id: user_id,
			status: 1
		}).then(res => {
			console.log(res, '获取订单信息');
			_this.list = res.data.data
		})
	  //   uni.request({
	  //     url: app.post_url + '/api/v1/select_order',
	  //     //仅为示例，并非真实的接口地址
	  //     data: {
	  //       user_id: user_id,
	  //       status: 1
	  //     },
	  //     method: 'post',
	  
	  //     success(res) {
	  //       console.log(res);
			// _this.list = res.data.data.data
	  //       // _this.setData({
	  //       //   list: res.data.data.data,
	  //       //   num: res.data.data.data.length
	  //       // });
	  //       console.log(_this.list);
	  //     }
	  
	  //   });
	  },
    handleChange({
      detail
    }) {
      console.log(detail);
    }

  }
};
</script>
<style>
@import "./index.css";
</style>